package com.liu.config;

import com.sun.org.apache.xpath.internal.operations.Mod;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author: 刘浩然
 * @Date: 2020/3/24 18:23
 */
@ControllerAdvice
public class ExceptionController {
@ExceptionHandler(AuthorizationException.class)
public ModelAndView error(AuthorizationException e){
    ModelAndView mv= new ModelAndView("unauthorized");
    mv.addObject("error",e.getMessage());
    return mv;
}
}
